package  
{
	import org.flixel.*;
	import org.flixel.plugin.photonstorm.*;
	/**
	 * ...
	 * @author le-ray_y
	 */
	public class Minion extends FlxSprite
	{	
		//************************************************************************
		//** 							VARIABLES								**
		//************************************************************************
		
		// Enemy Graphics
		[Embed(source = '../../Assets/enemy.png')]
		private static var _enemyGraph:Class;
		
		// Enemy Path
		private var _enemyPath:FlxPath = new FlxPath();		
		
		//************************************************************************
		//** 							FUNCTIONS								**
		//************************************************************************
		
		public function Minion(posX:Number, posY:Number, _health:Number, _speed:Number)
		{
			this.x = posX;
			this.y = posY;
			
			// Graphic
			this.loadGraphic(_enemyGraph, true, false, 43, 37);
			
			// Animations
			this.addAnimation("idle", [0]);
			this.addAnimation("walk", [0, 1], 5);
			
			this.health = _health;
			this.pathSpeed = _speed;
			
			// Enemy Path
			var rand:Number = Math.random() * 25;
			_enemyPath.nodes = new Array(new FlxPoint(-30, 515 + rand), new FlxPoint(800, 515 + rand));
			this.followPath(_enemyPath, this.pathSpeed);
		}
		
		override public function update():void
		{
			super.update();
			
			this.play("walk");
		}
		
		override public function kill():void
		{
			super.kill();
		}
	}
}